<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8" isELIgnored="false"%>
<%@ include file="/WEB-INF/views/shared/taglib.jsp"%>
<%
	request.setAttribute("modelConfigPath", "billing");
%>
<%@ include file="/WEB-INF/views/shared/master/contentHeader.jsp"%>
<style >
	#outStockInfoCopy{display:none}
	td input{height:21px; width:98%;border:none;}
	td{height:21px;padding: 2px 2px !important;text-align:center }
	#area{
		height:352px;
		overflow-y:auto; 
		overflow-x:hidden; 
	}
</style>
<ul class="nav nav-tabs nav-tabs-component " style="margin-bottom: 0px;">
	<li class="active"><a href="#category-tab" data-toggle="tab" >订单详情</a></li>
	<li><a href="#outStock-tab" data-toggle="tab" >出库记录</a></li>
	<li><a href="#billingRecord-tab" data-toggle="tab" >订单操作记录</a></li>
</ul>
<div class="tab-content">
	<div class="tab-pane active" id="category-tab">
		<t:panel cssClass="panel-flat form-detailed" customBody="true" customHead="true">
			<div class="detailed-navbar-content panel-body">
				<t:form modelAttribute="billing" action="/billing/billing/save" method="post" cssClass="form-horizontal">
					<div class="hide">
						 <t:hidden path="billingId"/>
		 				 <t:hidden path="deleteMark"/>	
		 				 <t:hidden path="createUserName"/>
				 		 <t:hidden path="createUserId"/>
				 		 <t:hidden path="createDate"/>
				 		 <t:hidden path="shopId"/>
				 		 <t:hidden path="confirm"/>
					</div>
		            <t:formgroup>
		            	<t:label path="billingNo" cssClass="col-sm-1 col-xs-1" />
		                <t:input readonly="true" path="billingNo" colClass="col-sm-2 col-xs-2" />
		                <t:label path="customerId" cssClass="col-sm-1 col-xs-1" />
		                <t:select2 path="customerId" placeholder="请填写客户" allowClear="true" colClass="col-sm-2 col-xs-2"></t:select2>
		            	<t:label path="deliveryDate" cssClass="col-sm-1 col-xs-1" />
		                <t:date  path="deliveryDate" colClass="col-sm-2 col-xs-2"></t:date>
		                <t:label path="businessId" cssClass="col-sm-1 col-xs-1" />
		                <t:select2 path="businessId" placeholder="业务员" allowClear="true" colClass="col-sm-2 col-xs-2"></t:select2>
		           </t:formgroup>
		            <t:formgroup>
		            	<t:label path="billingMoney" cssClass="col-sm-1 col-xs-1" />
						<t:input path="billingMoney" colClass="col-sm-2 col-xs-2" />
		                <t:label path="discount" cssClass="col-sm-1 col-xs-1" />
						<t:input path="discount" colClass="col-sm-2 col-xs-2" />
						<t:label path="comment" cssClass="col-sm-1 col-xs-1" />
						<t:input path="comment" colClass="col-sm-2 col-xs-2" />
		            </t:formgroup>
		            <div id="area">
		            <table  class="cntable table table-bordered dataTable table-billing">
			            <thead>
			            	<tr class="success">
				            	<th style="width:80px">序号</th>
				            	<th style="width:150px">商品编码</th>
		            			<th style="width:200px">商品名称</th>
				            	<th style="width:150px">规格</th>
				            	<th style="width:100px">单位</th>
				            	<th style="width:100px">数量</th>
				            	<th style="width:100px">单价</th>
				            	<th>小计</th>
			            	</tr>
			            </thead>
			            
			            <tbody id="outStockInfo">
							<c:set var="sequence"  value="0"/>

							<c:forEach var="outStockShow" items="${billing.outStock.outStockShows}">
								<c:forEach var="outStockCollocation" items="${outStockShow.outStockCollocations}" >
									
									<tr id="outStockCollocation_${sequence}">
										<td style="display:none"><input id="collocationId_${sequence}" name="collocationId" type="text" value="${outStockCollocation.collocationId}"/></td>
										<td style="display:none"><input id="cargoId_${sequence}" name="cargoId" type="text" value="${outStockShow.cargoId}"/></td>
										<td>${sequence+1}</td>
						            	<td><input style="ime-mode:disabled" id="cargoNo_${sequence}" name="cargoNo" type="text" value="${outStockShow.cargo.cargoNo}"></input></td>
						            	<td><input style="ime-mode:disabled" disabled="disabled" id="cargoName_${sequence}" name="cargoName" type="text" value="${outStockShow.cargo.cargoName}"/></td>
						            	<td><input style="ime-mode:disabled" disabled="disabled" id="propertyName_${sequence}" name="propertyName" type="text" value="${outStockCollocation.collocation.propertyNameOne}/${outStockCollocation.collocation.propertyNameTwo}"/></td>
										<td ><input style="ime-mode:disabled" disabled="disabled" id="unit_${sequence}" name="unit" type="text" value="${outStockShow.cargo.unit}"/></td>
										
										<td><input style="ime-mode:disabled"  onkeyup="return ValidateNumber(this,value)" id="collocationNum_${sequence}"  name="collocationNum" type="text" value="${outStockCollocation.collocationNum}"/></td>
										<td><input style="ime-mode:disabled"  onkeyup="return ValidateNumber(this,value)" id="realPrice_${sequence}" name="realPrice" type="text" value="${outStockCollocation.realPrice}"/></td>
										<td><input style="ime-mode:disabled" id="subtotal_${sequence}" name="subtotal" type="text" value="${outStockCollocation.realPrice*outStockCollocation.collocationNum}"/></td>
									</tr>
									<c:set var="sequence"  value="${sequence +1}"/>
								</c:forEach>
							</c:forEach>
								
						</tbody>
		            </table>
					</div>
				</t:form>
			</div>
		
		</t:panel>
	</div>
	<div class="tab-pane" id="outStock-tab">
		<iframe id="outStockIframe" name="outStockIframe" scrolling="auto" frameborder="0"
				scrolling="yes" width="100%" height="100%"  data-src="<c:url value='/stock/outStock/index?billingId=${billing.billingId }&level=5'/>">
        </iframe>
	</div>
	<div class="tab-pane" id="billingRecord-tab">
		<iframe id="billingRecordIframe" name="billingRecordIframe" scrolling="auto" frameborder="0"
				scrolling="yes" width="100%" height="100%"  data-src="<c:url value='/billing/billingRecord/index?billingId=${billing.billingId }'/>">
        </iframe>
	</div>
</div>
<script type="text/javascript">

$(function(){
	iframeLazyOpen();
	tabpaneResize();
})

function iframeLazyOpen(){
	$(".nav.nav-tabs.nav-tabs-component li a").click(function(){
		var iframeTab = $(this).attr("href");
		var iframeId = iframeTab.substring(0,iframeTab.indexOf("-")) + "Iframe";
		$(iframeId).attr("src",$(iframeId).attr("data-src"));
	});
}

function tabpaneResize(){
	$(".tab-pane").height($(window).height() - 50);	
	$(window).bind("resize",function(){$(".tab-pane").height($(window).height() - 50)});	
}

</script>
<%@ include file="/WEB-INF/views/shared/base/scripts/jqueryui.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/formtags.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/formbuttons.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/formpickers.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/formselects.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/formstyling.jsp"%>
<%@ include file="/WEB-INF/views/shared/master/dialog.jsp"%>
<%@ include file="/WEB-INF/views/shared/master/contentFooter.jsp"%>